{% extends "base.volt" %}

{% block pageFooter%}
    {{ javascript_include("/assets/manage/js/question/tagList.js", false) }}
{% endblock %}

{% block content %}
    {{ partial("module/left_question") }}
    <div class="col-xs-10">
        <ol class="breadcrumb">
            <li><a href="{{ url.get('question/list') }}">问答</a></li>
            <li><a href="{{ url.get('question/list') }}">问答管理</a></li>
            <li class="active">问答分类管理</li>
        </ol>

        <table class="table table-hover">
            <thead>
            <tr>
                <th>ID</th>
                <th>名称</th>
                <th>排序<br /><small>(值大的靠前)</small></th>
                <th>状态</th>
                <th></th>
            </tr>
            </thead>
            {% for d in data %}
                <tr>
                    <td>{{ d.tag_id }}</td>
                    <td>{{ d.tag_title|e }}</td>
                    <td>{{ d.tag_order }}</td>
                    <td>{{ GeneralStateValue2Str(d.tag_state) }}</td>
                    <td>
                        <div class="dropdown">
                            <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu{{ d.tag_id }}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"><i class="fa fa-cogs"></i> 操作 <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu" aria-labelledby="dropdownMenu{{ d.tag_id }}">
                                <li><a href="javascript:void(0)" durl="{{ url.get('questiontag/update', ['id': d.tag_id]) }}" class="but_update"><i class="fa fa-pencil fa-fw"></i> 更新</a></li>
                                <li role="separator" class="divider"></li>
                                {% if d.tag_state == 1 %}
                                    <li><a href="javascript:void(0)" durl="{{ url.get('questiontag/setState') }}" did="{{ d.tag_id }}" dstate="-1" class="but_set_state"><i class="fa fa-trash-o fa-fw"></i> 删 除</a></li>
                                {% endif %}
                                {% if d.tag_state == -1 %}
                                    <li><a href="javascript:void(0)" durl="{{ url.get('questiontag/setState') }}" did="{{ d.tag_id }}" dstate="1" class="but_set_state"><i class="fa fa-reply fa-fw"></i> 恢 复</a></li>
                                {% endif %}
                            </ul>
                        </div>
                    </td>
                </tr>
            {% endfor %}
        </table>

        <div class="row">
            <div class="col-xs-12 text-center">
                <button durl="{{ url.get('questiontag/update') }}" class="btn btn-primary but_question_tag_add"><i class="fa fa-plus fa-lg"></i> 添加新分类</button>
            </div>
        </div>
    </div>
{% endblock %}